<template>
	<layout :loading="loading" curPage="paramConfig" :title="data.id ? '修改菜单':'新增菜单'">

		<form class="layui-form" @submit="submit" data-action="/admin/paramConfig/save" data-rediret="/pages/paramConfig/paramConfigList">

			<div class="layui-col-md6">
				
				<singleSelect @change="changeId" :showDefault="false" title="参数项" :list="list" name="x.id" :value="data.id"></singleSelect>
				
				<textareaGroup :maxlength="100000" name="x.value|参数值" title="参数值" :value="data.value"></textareaGroup>
				
				<textareaGroup name="x.remark|备注|empty" title="备注" :value="data.remark" placeholder="选填"></textareaGroup>
				
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" form-type="submit">{{ !data.id ? '保存' : '修改'}}</button>
					<button class="layui-btn layui-btn-primary" form-type="reset">重置</button>
					<button class="layui-btn layui-btn-primary" @click="kit.goBack('index')">取消</button>
				</div>
			</div>
		</form>

	</layout>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				loading: false,
				data : {id:""}
			}
		},
		onLoad(params) {
			this.data.id = params.id ;
		},
		onShow() {
			this.loadData();
		},
		methods: {
			
			changeId:function(e){
				this.data = { id : e.value };
				this.loadData();
			},
			
			submit:function(e){
				console.log(e)
				this.form.submit(e);
			},
			
			loadData : function(e){
				var that = this ;
				var data = {
					id : this.data.id 
				} ;
				this.kit.get("/admin/paramConfig/info",data,function(res){
					that.list = res.list || [] ;	
					that.data = res.data || that.data ;
					console.log(that.data)
				});
			}
		}
	}
</script>

<style>

</style>
